#ifndef _X_LOG_OUTPUT_H
#define _X_LOG_OUTPUT_H
#include "xLogLevel.h"
#include "xLogEvent.h"
#include "xLogFormat.h"
namespace XLog
{

    class XLogOutputLocationBase
    {
    public:
        virtual ~XLogOutputLocationBase(){}
        virtual void out(const XLogEvent* event,XLogFormat* format)=0;
    };

    //use one day update file
    class XLogOutputFile : public XLogOutputLocationBase
    {
    public:
        XLogOutputFile(const char* fileName);
        ~XLogOutputFile();
        void out(const XLogEvent* event,XLogFormat* format) override;
    private:
        bool init();
        bool open();
        void checkUpateFile();
        void changeLogFile(); 
    private:
        const char* strFileName;
        std::string strLogDir;
        uint32_t lastUpateLogFileTime;
        FILE* filePtr;
        bool isInit;
    };

    class XLogOutputConsole : public XLogOutputLocationBase
    {
    public:
        void out(const XLogEvent* event,XLogFormat* format) override;
    };

}

#endif